package com.gc.rss;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.List;


import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class AAA {
/*public static void main(String[] args) {
new ReadRSS().readRss();
}
@SuppressWarnings("unchecked")
*/
public List<SyndEntry> readRss(String a) {
	//System.out.println("���ߣ�" );
	URL feedSource = null; 
	try {
	//feedSource = new URL("http://blog.sina.com.cn/rss/1656695927.xml");
		feedSource = new URL(a);
	} catch (MalformedURLException e) {
	e.printStackTrace();
	}
	SyndFeedInput input = new SyndFeedInput();
	SyndFeed feed = null; 
	try {
	feed = input.build(new XmlReader(feedSource));
	} catch (IllegalArgumentException e) {
	e.printStackTrace();
	} catch (FeedException e) {
	e.printStackTrace();
	} catch (IOException e) {
	e.printStackTrace();
	}
	String author = feed.getAuthor();
	String title = feed.getTitle();
	String link = feed.getLink();
	Date pubDate = feed.getPublishedDate();
	//System.out.println("���ߣ�" + author + "���⣺" + title + "��ҳ���ӣ�" + link + "�������ڣ�" + pubDate);
	List<SyndEntry> syndEntries = (List<SyndEntry>)feed.getEntries();
	/*
	for (SyndEntry syndEntry : syndEntries) {
	String entryTitle = syndEntry.getTitle();
	String entryLink = syndEntry.getLink();
	SyndContent entryDescription = syndEntry.getDescription();
	String content = entryDescription.getValue();
	System.out.println("���⣺" + entryTitle + "\n" + "���ӣ�" + entryLink + "\n" + "���ݣ�" + content);
	}*/
	return  syndEntries;

	}
	
	
	}
